home *** CD-ROM | disk | FTP | other *** search
-
-
- /* $VER: statickyupdate.rexx v1.0 (06.07.99)
-
- Amiga client for Staticky's dynamic DNS service
- by Robert Wilson - robert@dynamix.force9.co.uk - http://www.dynamix.force9.co.uk
-
- For more info on Staticky, please take a look at http://www.staticky.com
-
- If anyone wants to improve the rxsocket version and add timeout feature then
- please do ;-) Personally I'm a bit confused by rxsocket at the moment :(
-
- Note: Please don't add code that requires additional libraries!
- */
-
- /* start user settings */
-
- userxsocket = 0
-
- /* end user settings */
-
- signal on BREAK_C
-
- parse arg username' 'password' 'hostname
-
- if username = '?' then help()
- if length(username) = 0 then die('Error! Check your username and try again!')
- if length(password) = 0 then die('Error! Check your password and try again!')
- if length(hostname) = 0 then hostname = username
-
- string = username':'password':'hostname'.staticky.com'
-
- if userxsocket = 1 then call rxsocket()
- else call tcpdevice()
-
- exit
-
- /* rxsocket.library version */
-
- rxsocket:
-
- if ~show('l','rxsocket.library') then do
- if ~addlib('rxsocket.library',0,-30,0) then die('Unable to add rxsocket.library')
- end
-
- sock = openconnection('tcp','10980','dyndns.staticky.com')
-
- if sock < 0 then do
- select
- when sock = -2 then die('Error! Unable to connect to Staticky''s server')
- otherwise die('Error! Connection failed -' errorstring(errno()))
- end
- end
-
- if send(sock,string) ~= length(string) then call die('Error! -' errorstring(errno()))
-
- chars = recv(sock,'ANSWER',1)
- if left(answer,1) ~= 'S' then die('Error! Update failed, check your settings and try again')
- else say 'Success - IP address updated ;-)'
-
- return
-
- /* tcp: device version */
-
- tcpdevice:
-
- if open(tcp,'TCP:dyndns.staticky.com/10980','w') then do
- call writech(tcp,string)
- answer = readch(tcp)
- if answer ~= 'S' then die('Error! Update failed, check your settings and try again')
- else say 'Success - IP address updated ;-)'
- end
- else die('Error! Unable to connect to Staticky''s server!')
-
- return
-
- /* common functions */
-
- die:
- parse arg message
- say message
- exit 5
- return
-
- help:
- say 'Usage ''rx statickyupdate.rexx username password [hostname]'''
- exit
- return
-
- BREAK_C:
- call die('User break (CTRL-C)')
- return
-